
public class  类{
    public static void main(String[] args) {
        // 与（&）运算练习
        boolean and1 = true & true;
        boolean and2 = true & false;
        boolean and3 = false & false;
        boolean and4 = false & true;
        System.out.println("true & true = " + and1);
        System.out.println("true & false = " + and2);
        System.out.println("false & false = " + and3);
        System.out.println("false & true = " + and4);

        // 或（|）运算练习
        boolean or1 = false | true;
        boolean or2 = true | true;
        boolean or3 = true | false;
        boolean or4 = false | false;
        System.out.println("false | true = " + or1);
        System.out.println("true | true = " + or2);
        System.out.println("true | false = " + or3);
        System.out.println("false | false = " + or4);

        // 异或（^）运算练习
        boolean xor1 = false ^ true;
        boolean xor2 = true ^ false;
        boolean xor3 = false ^ false;
        boolean xor4 = true ^ true;
        System.out.println("false ^ true = " + xor1);
        System.out.println("true ^ false = " + xor2);
        System.out.println("false ^ false = " + xor3);
        System.out.println("true ^ true = " + xor4);

        // 非（!）运算练习
        boolean not1 = !true;
        boolean not2 = !false;
        System.out.println("!true = " + not1);
        System.out.println("!false = " + not2);

        // 短路与（&&）运算练习
        boolean andShort1 = true && true;
        boolean andShort2 = true && false;
        boolean andShort3 = false && false;
        boolean andShort4 = false && true;
        System.out.println("true && true = " + andShort1);
        System.out.println("true && false = " + andShort2);
        System.out.println("false && false = " + andShort3);
        System.out.println("false && true = " + andShort4);

        // 短路或（||）运算练习
        boolean orShort1 = false || true;
        boolean orShort2 = true || true;
        boolean orShort3 = true || false;
        boolean orShort4 = false || false;
        System.out.println("false || true = " + orShort1);
        System.out.println("true || true = " + orShort2);
        System.out.println("true || false = " + orShort3);
        System.out.println("false || false = " + orShort4);
    }
}